<%@page import="com.hospital.util.DbUtil"%>
<%@page import="java.util.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<link href="images/main.css" rel="stylesheet" type="text/css" />
<link  href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/trim.js"></script>
<script language="javascript" type="text/javascript" src="../My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
		function sub(){
		var ypmc = document.getElementById("ypmc");
		var cases = document.getElementById("cases");
		var ypsl = document.getElementById("ypsl");
		if(ypmc.value == '1001'){
			ypsl.value = 0;
			document.forms["form"].submit();
		}else if(trim(cases.value).length == 0){
			alert("病人病情不能为空。");
			cases.focus();
		}else if(trim(ypsl.value).length == 0){
			alert("药品数量不能为空。");
			ypsl.focus();
		}else{
			document.forms["form"].submit();
		}
	}
</script>
</head>
<body onload="init();">
	<jsp:include page="right_top.jsp"></jsp:include>
	<!-- TOP START -->
	<div id="right_font">
		<img src="images/main_14.gif" /> 您现在所在的位置：首页 → 就诊信息管理 → <span
			class="bfont">修改就诊信息</span>
	</div>
	<!-- TOP END -->
	<%
		String message = (String)request.getAttribute("message");
		if(message == null){
			message = "";
		}
		if (!message.trim().equals("")){
			out.println("<script language='javascript'>");
			out.println("alert('"+message+"');");
			out.println("</script>");
		}
		request.removeAttribute("message");
	%>
	<hr >
	<form action="CureServlet?method=modify" method="post" name="form" id="form">
	<% 
		int id = Integer.parseInt(request.getParameter("id"));
		String sql = "select * from t_cure where id = " + id;
		Map<String, Object> map  = (Map<String, Object>)DbUtil.find(sql).get(0);
	%>
		<table style="margin-top: 30px;">
			<tr height="30px;">
				<td><font color="#FF0000">*</font>挂号编码：</td>
				<td><%=map.get("orderid") %></td>
				<%String orderid = (String)map.get("orderid"); %>
				<td width="220px;">&nbsp;</td>
			</tr>
			<tr height="30px;">
				<td><font color="#FF0000">*</font>病&nbsp;&nbsp;情：</td>
				<td>
				<textarea rows="8" cols="35" name="cases" id="cases" style=" font-size:13px;"></textarea>
				</td>
				<td>&nbsp;</td>
			</tr>
			<tr height="30px;">
				<td><font color="#FF0000">*</font>药物名称：</td>
				<td>
				<select name="ypmc" id="ypmc">
					<% 
						//添加进入t_medicinename中的Id号码
						String sql_medicine = "select * from t_medicinename";
						List<Map<String, Object>> list_medicine = DbUtil.find(sql_medicine);
						Map<String, Object> map_medicine = null;
						for (int i = 0; i < list_medicine.size(); i++) {
							map_medicine = (Map<String, Object>)list_medicine.get(i);
					%>
						<option value="<%=map_medicine.get("id")%>"><%=map_medicine.get("mname") %></option>
					<% 
						}
					%>
				</select>
				</td>
				<td>&nbsp;</td>
			</tr>
			<tr height="30px;">
				<td><font color="#FF0000">*</font>药品数量：</td>
				<td><input type="text" name="ypsl" id="ypsl" maxlength="12" /></td>
				<td>&nbsp;</td>
			</tr>
			<tr height="30px;">
				<td><font color="#FF0000">*</font>检查项目名称：</td>
				<td>
				<select name="item" id="item">
					<% 
						String sqlitem = "select * from t_checklist";
						List<Map<String, Object>> listitem = DbUtil.find(sqlitem);
						Map<String, Object> mapitem = null;
						for (int i = 0; i < listitem.size(); i++) {
							mapitem = (Map<String, Object>)listitem.get(i);
					%>
						<option value="<%=mapitem.get("id")%>"><%=mapitem.get("name") %></option>
					<% 
						}
					%>
				</select>
				</td>
				<td>&nbsp;</td>
			</tr>
			<tr height="30px;">
				<td><font color="#FF0000">*</font>是否住院：</td>
				<td>
					<select name="Inhospitable" id="Inhospitable">
						<option value="yes">办理住院</option>
						<option value="no">无需住院</option>
					</select>
				</td>
				<td>&nbsp;</td>
			</tr>
			<tr height="30px;">
				<td colspan="2" align="center">
					&nbsp;<input type="hidden" name="orderid" value="<%=orderid %>" /> 
				</td>
				<td>&nbsp;</td>
			</tr>
			<tr height="30px;">
				<td colspan="2" align="center">
					&nbsp;<input type="hidden" name="id" value="<%=id %>" /> 
				</td>
				<td>&nbsp;</td>
			</tr>
			<tr height="30px;">
				<td colspan="2" align="center">
					<input type="button" value="提交" onclick="sub();"/>&nbsp;&nbsp;
					<input type="button" value="返回" onclick="history.go(-1);" />
				</td>
				<td>&nbsp;</td>
			</tr>
		</table>
	</form>
</body>
</html>